/*
 * MainForm.java 主界面
 *
 * Created on __DATE__, __TIME__
 */

package com.ruif.view;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 *
 * @author __USER__
 */
public class MainFrame extends javax.swing.JFrame
{

    /**
     * 
     */
    private static final long serialVersionUID = -6286095831262390151L;

    /** Creates new form MainForm */
    public MainFrame()
    {
        initComponents();
        this.setExtendedState(JFrame.MAXIMIZED_BOTH);// 窗体最大化
    }

    //GEN-BEGIN:initComponents
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents()
    {

        desktopPane = new javax.swing.JDesktopPane();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu4 = new javax.swing.JMenu();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem_exit = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem3 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("\u76d1\u6d4b\u7cfb\u7edf\u4e3b\u754c\u9762");

        jMenu1.setText("\u6570\u636e\u7ba1\u7406");

        jMenu4.setText("\u8f66\u95f4\u673a\u5668\u5c55\u793a\u56fe");

        jMenuItem6.setText("\u65b0\u589e\u8bb0\u5f55");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jMenuItem6ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem6);

        jMenuItem5.setText("\u5c55\u793a\u8f66\u95f4");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jMenuItem5ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem5);

        jMenu1.add(jMenu4);

        jMenu3.setText("\u6d4b\u6e29\u8bb0\u5f55");

        jMenuItem1.setText("\u5c55\u5f00\u8bb0\u5f55");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem1);

        jMenuItem2.setText("\u65b0\u589e\u8bb0\u5f55");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem2);

        jMenu1.add(jMenu3);

        jMenuItem4.setText("\u7cfb\u7edf\u8bbe\u7f6e");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem4);

        jMenuItem_exit.setText("\u9000\u51fa\u7cfb\u7edf");
        jMenuItem_exit.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jMenuItem_exitActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem_exit);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("\u5e2e\u52a9");

        jMenuItem3.setText("\u67e5\u770b");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem3);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                desktopPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 591,
                Short.MAX_VALUE));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                desktopPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 452,
                Short.MAX_VALUE));

        pack();
    }// </editor-fold>
    //GEN-END:initComponents

    /**
     * 新增车间记录入口
     * @param evt
     */
    private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt)
    {
        AddCarFrame acf = new AddCarFrame();
        acf.setVisible(true);
        this.desktopPane.add(acf);
    }

    /**
     * 展示车间入口
     * @param evt
     */
    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt)
    {
        CarFrame cf = new CarFrame();
        cf.setVisible(true);
        this.desktopPane.add(cf);
    }

    /**
     * 系统设置入口
     * @param evt
     */
    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt)
    {
        SystemSetFrame ssf = new SystemSetFrame();
        ssf.setVisible(true);
        this.desktopPane.add(ssf);
    }

    /**
     * 帮助界面入口
     * @param evt
     */
    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt)
    {
        HelpFrame hf = new HelpFrame();
        hf.setVisible(true);
        this.desktopPane.add(hf);
    }

    /**
     * 查询Tempera记录并弹出新增页面入口
     * @param evt
     */
    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt)
    {
        AddTemperaFrame atf = new AddTemperaFrame();
        atf.setVisible(true);
        this.desktopPane.add(atf);
    }

    /**
     * 查询Tempera并展示页面入口
     * @param evt
     */
    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt)
    {
        ListTemperaFrame ltf = new ListTemperaFrame();
        ltf.setVisible(true);
        this.desktopPane.add(ltf);
    }

    /**
     * 退出系统功能
     * @param evt
     */
    private void jMenuItem_exitActionPerformed(java.awt.event.ActionEvent evt)
    {
        int flag = JOptionPane.showConfirmDialog(null, "确定退出系统？");
        if (flag == 0)
        {
            this.dispose();
        }
    }

    /**
     * @param args
     *            the command line arguments
     */
    public static void main(String args[])
    {
        java.awt.EventQueue.invokeLater(new Runnable()
        {
            public void run()
            {
                new MainFrame().setVisible(true);
            }
        });
    }

    //GEN-BEGIN:variables
    // Variables declaration - do not modify
    private javax.swing.JDesktopPane desktopPane;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem_exit;
    // End of variables declaration//GEN-END:variables

}